/*
 * Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.huawei.cloudapp.utils;

import java.util.regex.Pattern;

/**
 * CasConstantsUtil
 */
public class CasConstantsUtil {

    /**
     * cph:ip
     */
    public static final String IP = "ip";

    /**
     * check cph ip
     */
    public static final Pattern IP_PATTERN = Pattern.compile("^((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})(\\.((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})){3}$");

    /**
     * cph:port
     */
    public static final String PORT = "port";

    /**
     * background timeout
     * <p>timeout when back to home</p>
     */
    public static final String BACKGROUND_TIMEOUT = "background_timeout";

    /**
     * available play time
     * <p>unit is second</p>
     */
    public static final String AVAILABLE_PLAYTIME = "available_playtime";

    /**
     * ticket
     * <p>256 random numbers</p>
     */
    public static final String TICKET = "ticket";

    /**
     * sessionId
     */
    public static final String SESSION_ID = "session_id";

    /**
     * aes key
     * <p>generate by aes 128</p>
     */
    public static final String AES_KEY = "aes_key";

    /**
     * auth th
     * <p>authentication timestamp</p>
     */
    public static final String AUTH_TS = "auth_ts";

    /**
     * userid
     */
    public static final String USER_ID = "user_id";

    /**
     * touch_timeout
     */
    public static final String TOUCH_TIMEOUT = "touch_timeout";

    /**
     * frame_type
     */
    public static final String FRAME_TYPE = "frame_type";

    /**
     * encode_type
     */
    public static final String ENCODE_TYPE = "encode_type";

    /**
     * remote_scheduling_elb_ip
     */
    public static final String REMOTE_SCHEDULING_ELB_IP = "remote_scheduling_elb_ip";

    /**
     * remote_scheduling_elb_ip
     */
    public static final String REMOTE_SCHEDULING_ELB_PORT = "remote_scheduling_elb_port";

    /**
     * check aes key
     */
    public static final Pattern AES_KEY_PATTERN = Pattern.compile("^[0-9a-fA-F]{32}$");

    /**
     * check whether is positive number
     */
    public static final Pattern POSITIVE_NUMBER_PATTERN = Pattern.compile("^[1-9]\\d*$");


    public static final String FRAME_TYPE_H265 = "h265";
    public static final String FRAME_TYPE_H264 = "h264";

    public static final String RESOLUTION_720P = "720";
    public static final String RESOLUTION_1080P = "1080";

    public static final String DEFINITION_BEST = "best";
    public static final String DEFINITION_MAIN = "main";
    public static final String DEFINITION_BASIC = "basic";
}
